//
// Created by 123 on 2024/12/26.
//
/**
* 结构体指针
*/
#include "stdio.h"
#include "string.h"
typedef struct {
    char name[50];
    int age;
    float score;
} Student;

int main066(){
    Student  s1 = {"mary",19,88};
    Student* ptr = &s1;
    //通过指针访问成员变量
    printf("name:%s\n",ptr->name);
    printf("age:%d\n",ptr->age);
    printf("score:%.2f\n",ptr->score);

    //修改成员变量
    strcpy(ptr->name,"tom");
    ptr->age = 20;
    ptr->score = 98;
    printf("name:%s\n",ptr->name);
    printf("age:%d\n",ptr->age);
    printf("score:%.2f\n",ptr->score);

    return 0;
}